/*
* 入口js
* vue实例化，挂载路由，挂载vuex-store
* 注册全局组件(Vue  Cookie  ElementUI  Store  Router等)，
* 渲染App组件*/

import Vue from 'vue'
import Cookies from 'js-cookie'
import 'normalize.css/normalize.css'
import Element from 'element-ui'
import './styles/element-variables.scss'
import '@/styles/index.scss'
// 导入App第一个组件
import App from './App'
import store from './store'
import router from './router'
import './icons'
// 导入权限控制脚本
import './permission'
import './utils/error-log'
import * as filters from './filters'
import ElSelectTree from 'el-select-tree'
import AppConfig from './assets/config'

// 全局注册Elment
Vue.use(Element, {
  size: Cookies.get('size') || 'small'
})

// 注册自定义过滤器
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.config.productionTip = false

// 注册自定义组件ElSelectTree
Vue.use(ElSelectTree)

// 全局方法挂载  import AppConfig from './assets/config'
Vue.prototype.$appConfig = AppConfig

// 创建vue实例：挂载路由、挂载vuex-store、App.vue根组件
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
